package com.luck.easyfoodbatch.ui;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.luck.easyfoodbatch.R;

public class UserTypeActivity extends AppCompatActivity implements View.OnClickListener {
    private ImageView iv_back;
    private TextView tv_person;
    private TextView tv_company;
    private TextView tv_marker;
    private TextView tv_wholesaler;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_user_type);
        initView();
        setListener();
    }

    private void setListener() {
        iv_back.setOnClickListener(this);
        tv_person.setOnClickListener(this);
        tv_company.setOnClickListener(this);
        tv_marker.setOnClickListener(this);
        tv_wholesaler.setOnClickListener(this);

    }

    private void initView() {
        iv_back= (ImageView) findViewById(R.id.iv_back);
        tv_person= (TextView) findViewById(R.id.tv_person);
        tv_company= (TextView) findViewById(R.id.tv_company);
        tv_marker= (TextView) findViewById(R.id.tv_marker);
        tv_wholesaler= (TextView) findViewById(R.id.tv_wholesaler);
    }

    @Override
    public void onClick(View v) {
        Intent intent=new Intent(UserTypeActivity.this,RegisterActivity.class);
        switch (v.getId()){
            case R.id.iv_back:
                finish();
                break;
            case R.id.tv_person:
                intent.putExtra("typeName",tv_person.getText().toString());
                startActivity(intent);
                finish();
                break;
            case R.id.tv_company:
                intent.putExtra("typeName",tv_company.getText().toString());
                startActivity(intent);
                finish();
                break;
            case R.id.tv_marker:
                intent.putExtra("typeName",tv_marker.getText().toString());
                startActivity(intent);
                finish();
                break;
            case R.id.tv_wholesaler:
                intent.putExtra("typeName",tv_wholesaler.getText().toString());
                startActivity(intent);
                finish();
                break;
        }
    }
}
